package com.huawei.appgallery.assistantdock.base.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View.MeasureSpec;
import android.widget.RelativeLayout;
import o.dfc;

public class SquareRelativeLayout extends RelativeLayout {
    private int ˏ;

    public SquareRelativeLayout(Context context) {
        this(context, null);
    }

    public SquareRelativeLayout(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public SquareRelativeLayout(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        ॱ(attributeSet);
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private void ॱ(android.util.AttributeSet r5) {
        /*
        r4 = this;
        if (r5 == 0) goto L_0x001b;
    L_0x0002:
        r0 = 0;
        r1 = r4.getContext();	 Catch:{ Exception -> 0x001c, all -> 0x002a }
        r2 = o.beo$h.ॱᐧ;	 Catch:{ Exception -> 0x001c, all -> 0x002a }
        r0 = r1.obtainStyledAttributes(r5, r2);	 Catch:{ Exception -> 0x001c, all -> 0x002a }
        r1 = o.beo$h.ॱᐨ;	 Catch:{ Exception -> 0x001c }
        r2 = 1;
        r1 = r0.getInteger(r1, r2);	 Catch:{ Exception -> 0x001c }
        r4.ˏ = r1;	 Catch:{ Exception -> 0x001c }
        if (r0 == 0) goto L_0x001b;
    L_0x0018:
        r0.recycle();
    L_0x001b:
        return;
    L_0x001c:
        r1 = move-exception;
        r1 = "SquareRelativeLayout";
        r2 = "init(AttributeSet attrs) ";
        o.dna.ˊ(r1, r2);	 Catch:{ all -> 0x0034 }
        if (r0 == 0) goto L_0x001b;
    L_0x0026:
        r0.recycle();
        goto L_0x001b;
    L_0x002a:
        r1 = move-exception;
        r3 = r1;
        r1 = r0;
        r0 = r3;
    L_0x002e:
        if (r1 == 0) goto L_0x0033;
    L_0x0030:
        r1.recycle();
    L_0x0033:
        throw r0;
    L_0x0034:
        r1 = move-exception;
        r3 = r1;
        r1 = r0;
        r0 = r3;
        goto L_0x002e;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.huawei.appgallery.assistantdock.base.widget.SquareRelativeLayout.ॱ(android.util.AttributeSet):void");
    }

    protected void onMeasure(int i, int i2) {
        setMeasuredDimension(getDefaultSize(0, i), getDefaultSize(0, i2));
        int size = MeasureSpec.getSize(i);
        int size2 = MeasureSpec.getSize(i2);
        int measuredWidth = getMeasuredWidth();
        int measuredHeight = getMeasuredHeight();
        if (size >= measuredWidth) {
            size = measuredWidth;
        }
        if (size2 >= measuredHeight) {
            size2 = measuredHeight;
        }
        switch (this.ˏ) {
            case 0:
                size = size2;
                break;
            case 1:
                size2 = size;
                break;
            case 2:
                if (size <= size2) {
                    size = size2;
                    break;
                } else {
                    size2 = size;
                    break;
                }
            case 3:
                if (size >= size2) {
                    size = size2;
                    break;
                } else {
                    size2 = size;
                    break;
                }
            case 5:
                size2 = dfc.ˎ(getContext()) / 2;
                break;
            case 6:
                size = dfc.ˊ(getContext()) / 2;
                break;
        }
        super.onMeasure(MeasureSpec.makeMeasureSpec(size, 1073741824), MeasureSpec.makeMeasureSpec(size2, 1073741824));
    }
}
